﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UcUploadify.ascx.cs" Inherits="Honestysoft.Baseframework.WebUI.Uploadify.UcUploadify" %>
<link rel="Stylesheet" href="<%=Page.ResolveClientUrl("~/") %>Module2/Uploadify/js/uploadify.css" />     
<%--<script type="text/javascript" src="Uploadify/js/jquery.min.js"></script> --%>
<script type="text/javascript" src="<%=Page.ResolveClientUrl("~/") %>Uploadify/js/swfobject.js"></script> 
<script type="text/javascript" src="<%=Page.ResolveClientUrl("~/") %>Uploadify/js/jquery.uploadify.min.js"></script> 

<asp:HiddenField runat="server" ID="HidDataId" />
<asp:HiddenField runat="server" ID="HidDeleteId" />
<input type="file" name="uploadify" id="uploadify" /> 
<div id="fileQueue"></div>

<table cellpadding="0" cellspacing="0" class="tInfo" style="border:0;font-size:12px;font-family:宋体;">
    <asp:Repeater runat="server" ID="rptFiles">
        <ItemTemplate>
            <tr style="border:0"><td style="border:0;height:18px;">
            <%# GetUrl(Container.DataItem) %>
            </td></tr>
        </ItemTemplate>
    </asp:Repeater>
</table>

<asp:Button ID="btnBind" runat="server" style="display:none" OnClick="btnBind_Click" />
<asp:Button ID="btnDelete" runat="server" style="display:none" OnClick="btnDelete_Click" />
<input type="button" id="btnCustomUpload" style="display:none" class="cancel" onclick="javascript:$('#uploadify').uploadifyUpload();return false;" />
<script type="text/javascript">
    $(document).ready(function () {
        $("#uploadify").uploadify({
           'uploader': '<%=Page.ResolveClientUrl("~/") %>Uploadify/js/uploadify.swf', 
            'script': '<%=Page.ResolveClientUrl("~/") %>Uploadify/Upload.aspx?DataID=<%=DataId %>|<%=((int)FileStoreType).ToString() %>|<%=AttachmentBuType %>', 
            'cancelImg': '<%=Page.ResolveClientUrl("~/") %>Uploadify/js/cancel.png', 
            'folder': '<%=GetUploadFolder() %>', 
            'wmode':'transparent ',
            'queueID': 'fileQueue', 
            <%=GetIsAuto() %>, 
            <%=GetSizeLimit() %>
            <%=GetIsMulti() %>,
            'width': 66,
            'height': 16,
            'buttonImg' : '<%=Page.ResolveClientUrl("~/") %>Uploadify/images/addAtt.png',
            'onComplete': function (event, queueID, fileObj, response, data) {
               //alert(fileObj.name);
//               rebind(); //重新绑定列表
            },
            'onAllComplete':function(event,data){
               rebind();
            },
            'onSelect': function(e, queueId, fileObj) {
            }
        });
    });
    function rebind(){
        document.getElementById("<%=btnBind.ClientID %>").click(); //重新绑定列表
    }
    function deleteFile(id) {
        document.getElementById("<%=HidDeleteId.ClientID %>").value = id;
        document.getElementById("<%=btnDelete.ClientID %>").click(); //执行删除操作
    }
    function <%=GetUploadJavascriptFunctionName() %>(){
        document.getElementById('btnCustomUpload').click();
    }
</script> 


